<%@page import="java.sql.*"%>
<%@page import="com.mysql.*"%>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<style>
textarea {
    resize: none;
}
</style>
<body>
	<a href="/MovieProject/search">View Movies</a> 
	<%
	ArrayList<String> al = new ArrayList<String>();
	
    try{
    	int u = (Integer)request.getSession().getAttribute("uName");
    	
    	String movie = "Airheads";
    	String user = "kyleb";
    	int i = 3; // This should be the user id
    	
    	
  	
//Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = 
         DriverManager.getConnection
            ("jdbc:mysql://localhost:3306/moviedatabase","dbuser","dbpassword");

       Statement statement = connection.createStatement() ;
    
       //ResultSet rs = statement.executeQuery("select * from movies WHERE Title='"+movie+"'") ;
     	ResultSet rs = statement.executeQuery("select * from movies JOIN queue ON movies.MovieID = queue.MovieID JOIN users ON users._z4 = queue.UserID WHERE queue.UserID ="+u+";") ;  
     
     
     	
     	  String s = null;
     	
          while(rs.next()){ 
        	  s = rs.getString(2);
        	  al.add(s);
        }
          
          String ArrayData = "";
              for(String textItem : al)
              {

              ArrayData = ArrayData + "\n" + textItem;

              }
          
          
      
%>
<center>
    <h1>-----------------------</h1>
     
   
        <div align="center">
        
        
        
       <textarea readonly name="paragraph_text" cols="50" rows="20" ><%=ArrayData%></textarea>
         
</div>
<h1>-----------------------</h1>
</center>

<%
//**Should I input the codes here?**
          
        }
        catch(Exception e)
        {
             out.println("wrong entry"+e);
        }
%>


</body>
</html>